<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    let httpUrlStr = 'https://www.whatever.com?name=zhangsan&age=18&aaa=111';
    // { "name": "zhangsan", "age":  "18" }

    function urlToObj(url){
        let arr = url.split('?')
        let brr = arr[1].split('&')
        console.log(arr, brr)
        let obj = {}
        for (let i = 0;i<brr.length;i++) {
            let crr = brr[i].split('=')
            console.log(brr[i])
            obj[crr[0]] = crr[1]
        }
        return obj
    }

    console.log(urlToObj(httpUrlStr))
</script>
</body>
</html>